package fhp.hlhj.giantfold.customView

import android.content.Context
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.PopupWindow
import fhp.hlhj.giantfold.R
import fhp.hlhj.giantfold.adapter.LevelAnnualViewPagerAdp
import fhp.hlhj.giantfold.utils.MyUtils
import kotlinx.android.synthetic.main.annualized_pop.view.*

/**
 * author: FHP
 * data: on 2017\11\30 0030 13:41
 * E-Mail: 103945089@qq.com
 */
class AnnualizedPop(private var context: Context,private var page:Int) :PopupWindow() {
    private lateinit var view:View
    private lateinit var viewPagerAdp:LevelAnnualViewPagerAdp
    init {
        initPop()
        setPop()
    }
    private fun setPop() {
        this.width= (context.resources.displayMetrics.widthPixels*0.687).toInt()
        this.height= (context.resources.displayMetrics.heightPixels*0.415).toInt()
        this.isFocusable=true
    }
    private fun initPop() {
        view=LayoutInflater.from(context).inflate(R.layout.annualized_pop,null)
        contentView=view
        viewPagerAdp= LevelAnnualViewPagerAdp(context)
        view.viewPager.adapter=viewPagerAdp
        MyUtils.setIndicator(5,context,view.loIndictor,view.viewPager)
        view.viewPager.currentItem = page
    }
}